package org.javaboy.business.service;

import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BusinessService {

    @Autowired
    OrderService orderService;
    @Autowired
    StorageService storageService;

    @GlobalTransactional
    public String buy(Integer userId, Integer commodityCode, Integer count) {
        storageService.deduce(commodityCode, count);
        orderService.order(userId, commodityCode, count);
        return "success";
    }
}
